home *** CD-ROM | disk | FTP | other *** search
/ PC Graphics Unleashed / PC Graphics Unleashed.iso / ch17 / pi / rotrans / rotrans.pi < prev   
Encoding:
Text File  |  1994-08-03  |  1.5 KB  |  62 lines

  1. // Polyray scene file:  ROTRANS.PI
  2. // Author:  Rob McGregor
  3.  
  4. // A cylinder moves over a checkered floor
  5.  
  6. include "..\..\..\colors.inc"
  7. include "..\..\..\texture.inc"
  8.  
  9. // Define the range of the animation
  10. start_frame  0
  11. end_frame    27
  12. total_frames 28
  13. outfile "cyl"
  14.  
  15. // Set Up The Camera
  16. viewpoint {
  17.   from       <2.5, 3, -5>
  18.   at         <1.75, 0, 0>
  19.   up         <0, 1, 0>
  20.   angle      45
  21.   resolution 320, 200
  22.   aspect     1.6
  23. }
  24.  
  25. // Define the light source and background color
  26. light <-2, 4, -5>
  27. light <2, 4, -5>
  28. background midnight_blue
  29.  
  30. // Define the cylinder "CYL"
  31. // By default its location is the origin
  32. define CYL
  33. object {
  34.   cylinder <0, -0.75, 0>, <0, 0.75, 0>, 0.5
  35.   reflective_white
  36. }
  37.  
  38. define xPos 3.5 / total_frames * frame  // the translation distance
  39. define zAng 90 / end_frame * frame      // the rotation angle
  40.  
  41. // Define a checkered floor plane
  42. object {
  43.   // normal in Y direction
  44.   polygon 4, <-1 , 0, 1>, <-1, 0, -1>, <1, 0, -1>, <1, 0, 1>
  45.   scale <100.0, 100.0, 100.0>
  46.   translate <0, -2.0, 0>
  47.   texture {
  48.     checker sapphire_agate, white_marble 
  49.     scale <0.01, 1, 0.01>
  50.   }
  51. }
  52.  
  53. // Now we translate CYL 3.5 units along the x-axis 
  54. // and rotate it 90 degrees on the z-axis.
  55. // This takes place over 28 frames...
  56. object {
  57.   CYL
  58.   translate <0, 0, 0>     // CYL moves to origin for rotation
  59.   rotate <0, 0, zAng>     // CYL rotates zAng each frame
  60.   translate <xPos, 0, 0>  // CYL moves to xPos each frame
  61. }
  62.